package cn.com.connext.scrm.repository.master;

import cn.com.connext.scrm.domain.master.Relation;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface RelationRepository extends JpaRepository<Relation, String> {
    ///查询所有关注人的unionId
    @Query(value = "select r.followId from Relation r where r.userId = :userId")
    List<String> findFollowIdByUserId(@Param("userId") String userId);

    ///根据userId,followId查询关注关系
    Relation findOneByUserIdAndFollowId(String userId, String followId);
}
